<!doctype html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />

        <title>Perspective CLI</title>

        <link rel="stylesheet" crossorigin="anonymous" href="/node_modules/@perspective-dev/viewer/dist/css/pro.css" />
        <link rel="stylesheet" crossorigin="anonymous" href="/node_modules/@perspective-dev/workspace/dist/css/pro.css" />

        <script type="module" src="/node_modules/@perspective-dev/workspace/dist/cdn/perspective-workspace.js"></script>
        <script type="module" src="/node_modules/@perspective-dev/viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js"></script>
        <script type="module" src="/node_modules/@perspective-dev/viewer-d3fc/dist/cdn/perspective-viewer-d3fc.js"></script>

        <style>
            perspective-workspace {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
            }

            @media (max-width: 600px) {
                html {
                    overflow: hidden;
                }

                body {
                    position: fixed;
                    height: 100%;
                    width: 100%;
                    margin: 0;
                    overflow: hidden;
                    touch-action: none;
                }
            }
        </style>
    </head>

    <body>
        <perspective-workspace id="view1">
            <perspective-viewer table="data"></perspective-viewer>
        </perspective-workspace>
        <script type="module">
            import "/node_modules/@perspective-dev/viewer/dist/cdn/perspective-viewer.js";
            import perspective from "/node_modules/@perspective-dev/client/dist/cdn/perspective.js";

            // const WORKER = worker();
            var elem = document.getElementById("view1");
            var worker = await perspective.websocket(location.origin.replace("http", "ws"));
            elem.tables.set("data", worker.open_table("data_source_one"));
        </script>
    </body>
</html>
